/**
 * @author Phuc "Noel" Vo
 */
package com.example.noelwhereismystuffs.presenters;

import android.content.Context;

import com.example.noelwhereismystuffs.models.IRegisterModel;
import com.example.noelwhereismystuffs.models.User;
import com.example.noelwhereismystuffs.views.RegisterActivity.IRegisterView;

public class RegisterPresenter {
	private IRegisterModel myModel;
	private IRegisterView myView;
	private User myUser;
	private Context myContext;

	public RegisterPresenter(IRegisterView view, IRegisterModel model) {
		myView = view;
		myModel = model;
//		myContext = context;
	}

	/**
	 * Tell the model to register new user
	 * @param username
	 * @param email
	 * @param password
	 */
	public void onRegisterClick(String username, String email, String password) {
		myModel.register(username, email, password);
		myUser = myModel.getUser(email);
		myView.setUser(myUser);
		myView.advanceRegister();

	}

	/**
	 * Tell the view to handle cancel button
	 */
	public void onCancelClick() {
		myView.advanceCancel();

	}

}
